package com.csx.saas.platform.init.entity;

import cn.afterturn.easypoi.excel.annotation.Excel;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName;
import com.csx.basic.base.entity.Entity;
import com.csx.saas.platform.init.enumeration.InitPackageVersionStateEnum;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.*;
import lombok.experimental.Accessors;
import org.hibernate.validator.constraints.Length;

import javax.validation.constraints.NotEmpty;
import java.math.BigDecimal;
import java.time.LocalDateTime;
import java.util.List;

import static com.baomidou.mybatisplus.annotation.SqlCondition.LIKE;

/**
 * <p>
 * 实体类
 * 套餐版本
 * </p>
 *
 * @author ChenSongXin
 * @since 2021-02-28
 */
@Data
@NoArgsConstructor
@ToString(callSuper = true)
@EqualsAndHashCode(callSuper = true)
@Accessors(chain = true)
@TableName("saas_init_package_version")
@ApiModel(value = "InitPackageVersion", description = "套餐版本")
@AllArgsConstructor
public class InitPackageVersion extends Entity<Long> {

    private static final long serialVersionUID = 1L;

    /**
     * 版本编号
     */
    @ApiModelProperty(value = "版本编号")
    @NotEmpty(message = "版本编号不能为空")
    @Length(max = 20, message = "版本编号长度不能超过20")
    @TableField(value = "version_nbr", condition = LIKE)
    @Excel(name = "版本编号")
    private String versionNbr;

    /**
     * 版本名称
     */
    @ApiModelProperty(value = "版本名称")
    @Length(max = 50, message = "版本名称长度不能超过50")
    @TableField(value = "version_name", condition = LIKE)
    @Excel(name = "版本名称")
    private String versionName;

    /**
     * 版本logo
     */
    @ApiModelProperty(value = "版本logo")
    @Length(max = 255, message = "版本logo长度不能超过255")
    @TableField(value = "version_logo", condition = LIKE)
    @Excel(name = "版本logo")
    private String versionLogo;

    /**
     * 原价
     */
    @ApiModelProperty(value = "原价")
    @TableField("original_price")
    @Excel(name = "原价")
    private BigDecimal originalPrice;

    /**
     * 官方销售价
     */
    @ApiModelProperty(value = "官方销售价")
    @TableField("sale_price")
    @Excel(name = "官方销售价")
    private BigDecimal salePrice;

    /**
     * 渠道价格
     */
    @ApiModelProperty(value = "渠道价格")
    @TableField("supply_price")
    @Excel(name = "渠道价格")
    private BigDecimal supplyPrice;

    /**
     * 版本描述
     */
    @ApiModelProperty(value = "版本描述")
    @Length(max = 65535, message = "版本描述长度不能超过65535")
    @TableField("describe_")
    @Excel(name = "版本描述")
    private String describe;

    /**
     * 状态\n#{ENABLE:启用;DISABLE:禁用;}
     */
    @ApiModelProperty(value = "状态\n#{ENABLE:启用;DISABLE:禁用;}")
    @TableField("state")
    @Excel(name = "状态\n#{ENABLE:启用;DISABLE:禁用;}", replace = {"启用_ENABLE", "禁用_DISABLE",  "_null"})
    private InitPackageVersionStateEnum state;

    /**
     * 排序
     */
    @ApiModelProperty(value = "排序")
    @TableField("sort_value")
    @Excel(name = "排序")
    private Integer sortValue;

    @ApiModelProperty(value = "服务编号")
    @TableField(exist = false)
    private List<String> serviceNbrs;


    @Builder
    public InitPackageVersion(Long id, LocalDateTime createTime, Long createdBy, LocalDateTime updateTime, Long updatedBy, 
                    String versionNbr, String versionName, String versionLogo, BigDecimal originalPrice, BigDecimal salePrice, 
                    BigDecimal supplyPrice, String describe, InitPackageVersionStateEnum state, Integer sortValue) {
        this.id = id;
        this.createTime = createTime;
        this.createdBy = createdBy;
        this.updateTime = updateTime;
        this.updatedBy = updatedBy;
        this.versionNbr = versionNbr;
        this.versionName = versionName;
        this.versionLogo = versionLogo;
        this.originalPrice = originalPrice;
        this.salePrice = salePrice;
        this.supplyPrice = supplyPrice;
        this.describe = describe;
        this.state = state;
        this.sortValue = sortValue;
    }

}
